package com.storm.lib.generator;

import com.storm.lib.type.SystemType;
import com.storm.lib.util.BeanUtil;

public class BaseGenerator {
	
	public static String language=SystemType.LANGUAGE_PREFIX_SIMPLIFIED_CHINESE;
	
	public void generatorDB(String[] sheetsNames,boolean reCreateTable){
		DbBuilder dbBuilder = (DbBuilder) BeanUtil.getBean("dbBuilder");
		for (String sheetName : sheetsNames) {
			dbBuilder.execute(reCreateTable, sheetName, language);
		}
	}
	
	public void generatorPo(String[] sheetsNames){
		PoBuilder poBuilder = (PoBuilder) BeanUtil.getBean("poBuilder");
		for (String sheetName : sheetsNames) {
			poBuilder.execute(sheetName);
		}
	}
	
	public void generatorPoAndDB(String[] sheetsNames,boolean reCreateTable){
		PoBuilder poBuilder = (PoBuilder) BeanUtil.getBean("poBuilder");
		DbBuilder dbBuilder = (DbBuilder) BeanUtil.getBean("dbBuilder");
		for (String sheetName : sheetsNames) {
			dbBuilder.execute(reCreateTable, sheetName, language);
			poBuilder.execute(sheetName);
		}
	}
}
